# Contributor Ricky Wu <rickleaf.wu@hotmail.com>

_realname=gtkwave
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.3.105
pkgrel=1
pkgdesc='GTKWaveGTKWave is a fully featured GTK+ based wave viewer for Unix, Win32, and Mac OSX'
arch=('any')
url='https://gtkwave.sourceforge.io/'
license=('GPL')
depends=("${MINGW_PACKAGE_PREFIX}-gtk2"
         "${MINGW_PACKAGE_PREFIX}-tk"
         "${MINGW_PACKAGE_PREFIX}-tklib"
         "${MINGW_PACKAGE_PREFIX}-tcl"
         "${MINGW_PACKAGE_PREFIX}-tcllib"
         "${MINGW_PACKAGE_PREFIX}-adwaita-icon-theme")
makedepends=('perlxml'
             'intltool'
             "${MINGW_PACKAGE_PREFIX}-gcc")
install=gtkwave-${CARCH}.install
source=("https://gtkwave.sourceforge.io/${_realname}-${pkgver}.tar.gz")
sha256sums=('cf9757055ee3a1c5550cad66da1996e33145f8e13752e1c6ed2299ffb431612f')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  ./autogen.sh
}

build() {
  mkdir -p "build-${MINGW_CHOST}"
  cd "build-${MINGW_CHOST}"

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --with-tcl=${MINGW_PREFIX}/lib \
    --with-tk=${MINGW_PREFIX}/lib \
    --disable-mime-update

  make
}

package() {
  cd "build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
}
